<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
      function getPrimeNum(num){
        var flag =  true;
        for(var j = 2 ; j < num ; j++){
          if(num % j == 0){
            flag = false;
          }
        }
        if(flag == true){
            alert(num + '是质数');
        }else{
            alert(num + '不是质数');
        }
        
      }
      num = parseInt(prompt('请随意输入一个大于1的自然数'));
      getPrimeNum(num);
  </script>
</head>
<body></body>
</html>